package event

import (
	"context"
	"ez/apps/wms/auto/mc"
	wms "ez/apps/wms/document"
	"gitee.com/dreamwood/ez-go/ez"
)

func init() {
	ez.Subscribe(mc.ItemAttributeEventAfterSave, func(v interface{}, ctx context.Context) {
		md, ok := v.(*wms.ItemAttribute)
		if ok {
			md.Attribute = &wms.AttributeKey{Id: md.AttributeId}
			md.LoadAttribute()
			md.Name = md.Attribute.Name
			md.Save()
		}
	})
}
